#!/bin/sh

out=$1
sd=$2

mkdir -p tmp.boot
mkdir -p tmp.filesystem

sudo mount ${sd}1 tmp.boot
sudo mount ${sd}2 tmp.filesystem

sudo cp ${out}/boot/* tmp.boot -rf
sudo cp ${out}/filesystem/* tmp.filesystem -rf

sudo mkdir -p tmp.filesystem/root/out
sudo cp ${out}/boot tmp.filesystem/root/out -rf
sudo cp ${out}/filesystem tmp.filesystem/root/out -rf

sudo umount tmp.boot
sudo umount tmp.filesystem

rm -rf tmp.boot
rm -rf tmp.filesystem
